package edu.nf.exam.service.impl;

import edu.nf.exam.dao.UserTaskInfoDao;
import edu.nf.exam.dao.impl.UserTaskInfoDaoImpl;
import edu.nf.exam.entity.UserTaskInfo;
import edu.nf.exam.exception.DataAcessException;
import edu.nf.exam.service.UserTaskService;

import java.util.List;

/**
 * @Author : QYM
 * @create 2021/6/17
 * 用户任务表--业务接口实现类
 */
public class UserTaskServiceImpl implements UserTaskService {
    /**
     * 添加
     * @param userTaskInfo
     */
    @Override
    public void add(UserTaskInfo userTaskInfo) {
        UserTaskInfoDao dao=new UserTaskInfoDaoImpl();
        try {
            dao.add(userTaskInfo);
        } catch (Exception e) {
            e.printStackTrace();
            throw new DataAcessException("添加失败");
        }
    }

    /**
     * 多条件查询
     * @param userTaskInfo
     * @return
     */
    @Override
    public List<UserTaskInfo> select(UserTaskInfo userTaskInfo) {
        List<UserTaskInfo> list = new UserTaskInfoDaoImpl().select(userTaskInfo);
        return list;
    }

    /**
     * 修改
     * @param userTaskInfo
     */
    @Override
    public void update(UserTaskInfo userTaskInfo) {
        UserTaskInfoDao dao=new UserTaskInfoDaoImpl();
        try {
            dao.update(userTaskInfo);
        } catch (Exception e) {
            e.printStackTrace();
            throw new DataAcessException("修改失败");
        }
    }
}
